package cn.xd.base.basic.type;

import cn.hutool.crypto.SecureUtil;
import cn.xd.common.exception.BizException;
import cn.xd.core.ddd.value.basic.Value;

/**
 * <p>
 *
 * </p>
 *
 * @author chenyh
 * @since 2023-09-08
 */
public class Password extends Value<String> {

    public Password() {
        super();
    }

    public Password(String value) {
        super(value);
    }

    /**
     * 加密后创建
     */
    public static Password encrypt(String value) {
        Password obj = new Password(SecureUtil.md5(value));
        obj.validate(value);
        return obj;
    }

    /**
     * 创建
     */
    public static Password of(String value) {
        Password obj = new Password(value);
        obj.validate(value);
        return obj;
    }

    /**
     * 校验函数
     */
    @Override
    public void validate(String value) throws BizException {

    }
}



